package com.ebook.repository;

import com.ebook.entity.ReadingProgress;
import com.ebook.entity.User;
import com.ebook.entity.Book;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Optional;

@Repository
public interface ReadingProgressRepository extends JpaRepository<ReadingProgress, Long> {
    Optional<ReadingProgress> findByUserAndBook(User user, Book book);
    
    List<ReadingProgress> findByUserOrderByLastReadAtDesc(User user);
    
    List<ReadingProgress> findByUserAndProgressPercentageGreaterThanOrderByLastReadAtDesc(User user, Float percentage);
}